// const autoprefixer = require('autoprefixer');
const pxtorem = require('postcss-pxtorem');
const path = require('path');

module.exports = {
  productionSourceMap: false,
  publicPath: './',
  outputDir: 'ZLdist',
  lintOnSave: process.env.NODE_ENV !== 'production' ? 'warning' : false,
  configureWebpack: {
    devtool: 'source-map',
  },
  devServer: {
		port: 1704,
    proxy: {
      '/previewPDF': {
        target: 'http://132.232.21.253:1704',
        // target: 'http://192.168.200.167:1706',
        // target: 'http://192.168.200.167:1704',
        changeOrigin: true, // 允许跨域
        ws: true, // 允许websocket代理
        pathRewrite: (path) => path.replace('/previewPDF', '') //重写匹配的字段，如果不需要放在请求路径上，可以重写为""
      }
    }
  },
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ],
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        path.resolve(__dirname, './src/styles/vant-ui/variables.less')
      ]
    }
  },
  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          // autoprefixer(),
          pxtorem({
            rootValue: 37.5,
            propList: ['*'],
            exclude: /node_modules[\/\\]pdfh5/
          })
        ]
      },
      less: {
        modifyVars: {
          //定制vant主题的样式变量
          'hack': `true; @import "${path.join(
            __dirname,
            './src/styles/vant-ui/variables.less'
          )}";`
        }
      }
    }
  }
};